<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
	<head>
		<meta charset="UTF-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0" />
		<title>Just Center</title>
		<link rel="icon" th:href="${config.SITE_ICON}">
		<link rel="stylesheet" th:href="${config.SITE_CDN+'/static/css/bootstrap.min.css'}"/>
		<link rel="stylesheet" th:href="${config.SITE_CDN+'/static/iconfont/iconfont.css'}"/>
		<link rel="stylesheet" th:href="${config.SITE_CDN+'/static/css/app.css'}"/>
		<script th:src="${config.SITE_CDN+'/static/js/jquery.min.js'}"></script>
		<script th:src="${config.SITE_CDN+'/static/js/bootstrap.min.js'}"></script>
		<script th:src="${config.SITE_CDN+'/static/js/app.js'}"></script>
	</head>
	<body onhashchange="App.hashChange()">
		<div class="wrapper">
			<div class="main-sidebar">
				<div class="sidebar-scroll">
				    <section class="sidebar">
				      <ul class="sidebar-menu">
				      </ul>
				    </section>
			    </div>
		  	</div>
			<header th:replace="admin/fragments/header :: header"></header>
			<div class="content-tabs">
				<button class="roll-nav roll-left" onclick="App.scrollTabLeft()">
					<i class="fa fa-backward"></i>
				</button>
				<nav class="page-tabs" id="tab-menu">
					<div class="page-tabs-content" style="margin-left: 0px;">

					</div>
				</nav>
				<button class="roll-nav roll-right" onclick="App.scrollTabRight()">
					<i class="fa fa-forward" style="margin-left: 3px;"></i>
				</button>
				<div class="roll-nav btn-group">
					<button class="dropdown" data-toggle="dropdown">
						<i class="fa fa-caret-down"></i>
					</button>
					<ul class="dropdown-menu dropdown-menu-right">
						<li><a class="tabReload" href="javascript:App.refreshTab();">刷新当前</a></li>
						<li><a class="tabCloseCurrent" href="javascript:App.closeCurrentTab();">关闭当前</a></li>
						<li><a class="tabCloseAll" href="javascript:App.closeOtherTabs(true);">全部关闭</a></li>
						<li><a class="tabCloseOther" href="javascript:App.closeOtherTabs();">关闭其他</a></li>
					</ul>
				</div>
			</div>
			<div class="content-iframe">
				<div class="tab-content " id="tab-content">
				</div>
			</div>
		</div>
		<script>
			$(function(){
				//初始化系统
				App.init({prefix:"/admin/"});
				//初始化菜单
				var menus = [
		            {
				    id: '9000',
				    name: "首页",
	                icon: "ri-home-3-line",
				    url: 'welcome',
					},{
		                id: "9001",
		                name: "文章管理",
		                icon: "ri-stack-line",
		                children: [
		                	{
		                		id: "900101",
		                        name: "写文章",
		                        url: "article/add"
		                	},{
		                        id: "900102",
		                        name: "文章列表",
		                        url: "articles"
		                    },{
		                        id: "900103",
		                        name: "栏目管理",
		                        url: "categories"
		                    },{
		                        id: "900104",
		                        name: "标签管理",
		                        url: "tags"
		                    }
		                ]
		            },
		            {
		                id: "9002",
		                name: "网站管理",
		                icon: "ri-flag-line",
		                children: [
		                    {
		                        id: "900202",
		                        name: "主题管理",
		                        url: "themes"
		                    },{
								id: "900203",
								name: "友链管理",
								url: "links"
							},{
								id: "900204",
								name: "网站公告",
								url: "notifies"
							},{
								id: "900205",
								name: "轮播管理",
								url: "sliders"
							}
		                ]
		            },
					{
						id: '9003',
						name: "评论管理",
						icon: "ri-message-2-line",
						url: 'comments'
					},
                    {
                        id: '9004',
                        name: "文件管理",
                        icon: "ri-file-list-2-line",
                        url: 'files'
                    },
		            {
		                id: "9005",
		                name: "系统设置",
		                icon: "ri-settings-3-line",
						url: "config"
		            }
		        ];
				App.menuTree('.sidebar-menu',{data:menus,prefix:"/admin/"});
				//创建一个首页tab
				App.addTabs({
				    id: '9000',
				    title: '首页',
				    close: false,
				    url: 'welcome',
				    hashChange:false
				});
				//处理第一次进入刷新
				App.activeLocationHref(true);

				//系统是否已设置
				var systemIsSet = "[[${systemIsSet}]]";
				if(systemIsSet!=="1"){
				    App.confirm({content: "系统暂未设置，是否进行设置?"},function () {
                        App.addTabs({id:'9005',title: '系统设置',close: true,url: 'config',urlType: 'relative'});
					});
				}
			});

			function addTabs(options) {
			    if(options.hashChange){
                    parent.location.href="/admin#"+options.url;
				}else{
                    App.addTabs(options);
				}
			}
		</script>
	</body>
</html>
